package com.atguigu.common;

import lombok.Data;

/**
 * @Author: change
 * @Date: 2025/04/13 18:09
 */
@Data
public class R {
  private Integer code;
  private String msg;
  private Object data;
  
  public static R ok() {
    R r = new R();
    r.code = 200;
    r.msg = "ok";
    r.data = null;
    return r;
  }
  public static R ok(Integer code,String msg,Object data) {
    R r = new R();
    r.setCode(code);
    r.setMsg(msg);
    r.setData(data);
    return r;
  }
	
	public static R error() {
		R r = new R();
		r.setCode(500);
		r.setMsg("出错了");
		// r.setData();
		return r;
	}
	
	public static R error(Integer code,String msg) {
		R r = new R();
		r.setCode(code);
		r.setMsg(msg);
		return r;
	}
  
  public static R error(Integer code,String msg,Object data) {
	  R r = new R();
	  r.setCode(code);
	  r.setMsg(msg);
	  r.setData(data);
	  return r;
  }
}
